<?php
class userprofileWidget extends Widget {

	public function render(){
		$url = $this->get_self_url();
		if(strpos($url , 'sina' )){
			session_start();
			$sina_token_model = $this->model('sina_token');
			$tokendata = $sina_token_model->from('sina_token')->where('userid=?', $_SESSION['userid'])->select();
			set_include_path(dirname(dirname(__FILE__)) . '/extensions/sina/');
			include_once( 'config.php' );
			include_once( 'saetv2.ex.class.php' );
			$c = new SaeTClientV2( WB_AKEY , WB_SKEY , $tokendata[0]['access_token'] );
			$uid_get = $c->get_uid();
			$uid = $uid_get['uid'];
			$user_message = $c->show_user_by_id( $uid);//根据ID获取用户等基本信息


			$urldata = array();
			$urldata['myweibo'] = $this->create_url('sina/myweibo');
			$urldata['atme'] = $this->create_url('sina/atme');
			$this->assign('urldata' , $urldata);
			$this->assign('data' , $user_message);
			$this->display('userprofilesina');
		}
	}
}